var countBalls = function(lowLimit, highLimit) {
  let maxNumber = 0;
  const map = new Map();
  for(let i = lowLimit;i <= highLimit;i++){
      let num = i;
      let sum = 0;
      while(num > 0){
          sum += num % 10;
          num = Math.floor(num / 10);
      }
      if(map.has(sum)){
          map.set(sum,map.get(sum)+1);
      }else{
          map.set(sum,1);
      }
      maxNumber = Math.max(maxNumber,map.get(sum));
  }
  return maxNumber
};
console.log(countBalls(1,10));